#ifndef RTW_HEADER_PubMath_h_
#define RTW_HEADER_PubMath_h_
#include <math.h>
#ifndef Bldc_Svc_COMMON_INCLUDES_
#define Bldc_Svc_COMMON_INCLUDES_
#include "rtwtypes.h"
#define __TMWTYPES__
#endif

#include "Bldc_Svc_types.h"

typedef struct {
  uint16_T cnt0;
  uint16_T cnt1;
  uint16_T pre_y0;
  uint16_T pre_y1;
  uint16_T y0;
  uint16_T y1;
} DW_Hall_Signal_Cnt_05T_T;

typedef struct {
  int32_T UnitDelay_DSTATE;
} DW_N32RC1_LPF_MBD_T;

typedef struct {
  int32_T Pre;
} DW_N32Step_MBD_T;

typedef struct {
  int32_T UnitDelay_DSTATE;
  int32_T UnitDelay1_DSTATE;
} DW_Position_PID_Qn_T;

typedef struct {
  uint8_T y;
} DW_FuncQn_Bldc_Svc_T;

struct P_N32RC1_LPF_MBD_T_ {
  int32_T UnitDelay_InitialCondition;
};

struct P_Position_PID_Qn_T_ {
  int32_T Constant_Value;
  int32_T UnitDelay_InitialCondition;
  int32_T UnitDelay1_InitialCondition;
  uint8_T Switch2_Threshold;
  uint8_T Switch_Threshold;
  uint8_T Switch1_Threshold;
};

extern void Hall_Signal_Cnt_05T_Init(uint16_T *rty_o_y0, uint16_T *rty_o_y1);
extern void Hall_Signal_Cnt_05T(uint8_T rtu_i_x, uint16_T rtu_i_Max_05HoldTime,
  uint16_T *rty_o_y0, uint16_T *rty_o_y1, DW_Hall_Signal_Cnt_05T_T *localDW);
extern void N32RC1_LPF_MBD_Init(DW_N32RC1_LPF_MBD_T *localDW, P_N32RC1_LPF_MBD_T
  *localP);
extern void N32RC1_LPF_MBD_Update(int32_T *rty_Fil, DW_N32RC1_LPF_MBD_T *localDW);
extern void N32RC1_LPF_MBD(int16_T rtu_Inp, uint16_T rtu_kx, uint16_T rtu_ky,
  int32_T *rty_Fil, DW_N32RC1_LPF_MBD_T *localDW);
extern void N32Step_MBD_Init(int32_T *rty_o_Out);
extern void N32Step_MBD(int16_T rtu_Now, int16_T rtu_Step, uint8_T rtu_Reset,
  int16_T rtu_y0, int32_T *rty_o_Out, DW_N32Step_MBD_T *localDW);
extern void Position_PID_Qn_Init(DW_Position_PID_Qn_T *localDW,
  P_Position_PID_Qn_T *localP);
extern void Position_PID_Qn(int32_T rtu_Ref, int16_T rtu_Fdb, int32_T rtu_Kp,
  int32_T rtu_KiTs, int32_T rtu_Kc, uint8_T rtu_Kp_Qn, uint8_T rtu_Ki_Qn,
  uint8_T rtu_Reset, int32_T rtu_y0, int32_T *rty_Out, DW_Position_PID_Qn_T
  *localDW, P_Position_PID_Qn_T *localP, uint8_T rtp_Out_Qn, uint8_T rtp_Kc_Qn,
  int32_T rtp_Upper_Limit, int32_T rtp_Lower_Limit);
extern void Bldc_Svc_FuncQn_Init(uint8_T *rty_o_y);
extern void Bldc_Svc_FuncQn(real32_T rtu_i_x, uint8_T rtu_i_sys_Qn_max, uint8_T
  rtu_i_Qn, uint8_T *rty_o_y, DW_FuncQn_Bldc_Svc_T *localDW);
extern void Hall_Signal_Cnt_T(void);

#endif

